Skip to content

Repaired the broken benchmarks project #677

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 12, 2020
Merged

Repaired the broken benchmarks project #677

merged 1 commit into from
Feb 12, 2020

Conversation

bart-degreed
Copy link
Contributor

Removed SortService.CheckIfProcessed(), which was supposed to disallow multiple sort parameters. But it never worked. For example, if you pass http://host/path?sort=a&sort=b, it gets translated by Microsoft.AspNetCore.Http.QueryCollection into value "a,b". The check prevented to run benchmarks multiple times.

Also reactivated the build flag on all combinations of Platform/Configuration in Solution Configuration Manager for all projects.

Removed some benchmarks, for which no equivalent code exists anymore. But kept the benchmark on namespace-from-path extraction (and optimized a bit), because it nicely shows the perf difference between using strings and ReadOnlySpan<char>.

Also deleted old output markdown files from source control, as they differ per machine.

Finally, the stats from my laptop:

Method Mean Error StdDev
DeserializeSimpleObject 7.684 us 0.0692 us 0.0578 us
Method Mean Error StdDev
SerializeSimpleObject 7.871 us 0.1011 us 0.0946 us
Method Mean Error StdDev Median Gen 0 Gen 1 Gen 2 Allocated
AscendingSort 2.680 us 0.0211 us 0.0449 us 2.663 us 1.0185 0.0076 - 4.7 KB
DescendingSort 2.728 us 0.0258 us 0.0527 us 2.739 us 1.0262 0.0076 - 4.73 KB
ComplexQuery 3,258.409 us 25.9838 us 54.8087 us 3,230.178 us 1148.4375 281.2500 - 5308.28 KB
Method Mean Error StdDev Median Gen 0 Gen 1 Gen 2 Allocated
UsingStringSplit 244.66 ns 0.783 ns 1.702 ns 244.60 ns 0.1493 - - 704 B
UsingReadOnlySpan 69.72 ns 2.638 ns 5.680 ns 66.09 ns 0.0288 - - 136 B

Removed `SortService.CheckIfProcessed()`, which was supposed to disallow multiple sort parameters. But it never worked. For example, if you pass `http://host/path?sort=a&sort=b`, it gets translated by `Microsoft.AspNetCore.Http.QueryCollection` into value "a,b". The check prevented to run benchmarks multiple times.

Also reactivated the build flag on all combinations of Platform/Configuration in Solution Configuration Manager for all projects.

Removed some benchmarks, for which no equivalent code exists anymore. But kept the benchmark on namespace-from-path extraction (and optimized a bit), because it nicely shows the perf difference between using strings and `ReadOnlySpan<char>`.

Also deleted old output markdown files from source control, as they differ per machine.

Finally, the stats from my laptop:

|                  Method |     Mean |     Error |    StdDev |
|------------------------ |---------:|----------:|----------:|
| DeserializeSimpleObject | 7.684 us | 0.0692 us | 0.0578 us |

|                Method |     Mean |     Error |    StdDev |
|---------------------- |---------:|----------:|----------:|
| SerializeSimpleObject | 7.871 us | 0.1011 us | 0.0946 us |

|         Method |         Mean |      Error |     StdDev |       Median |     Gen 0 |    Gen 1 | Gen 2 |  Allocated |
|--------------- |-------------:|-----------:|-----------:|-------------:|----------:|---------:|------:|-----------:|
|  AscendingSort |     2.680 us |  0.0211 us |  0.0449 us |     2.663 us |    1.0185 |   0.0076 |     - |     4.7 KB |
| DescendingSort |     2.728 us |  0.0258 us |  0.0527 us |     2.739 us |    1.0262 |   0.0076 |     - |    4.73 KB |
|   ComplexQuery | 3,258.409 us | 25.9838 us | 54.8087 us | 3,230.178 us | 1148.4375 | 281.2500 |     - | 5308.28 KB |

|            Method |      Mean |    Error |   StdDev |    Median |  Gen 0 | Gen 1 | Gen 2 | Allocated |
|------------------ |----------:|---------:|---------:|----------:|-------:|------:|------:|----------:|
|  UsingStringSplit | 244.66 ns | 0.783 ns | 1.702 ns | 244.60 ns | 0.1493 |     - |     - |     704 B |
| UsingReadOnlySpan |  69.72 ns | 2.638 ns | 5.680 ns |  66.09 ns | 0.0288 |     - |     - |     136 B |
@maurei
Copy link
Member

maurei commented Feb 12, 2020

Thanks a lot for this! I never got into figuring out how the benchmarking works and never got to fixing it. I'm sure there is still lots to elaborate on in this field, that's something we can work on in the future.

@maurei maurei self-requested a review February 12, 2020 01:09
@maurei maurei merged commit efc1ab7 into json-api-dotnet:master Feb 12, 2020
@bart-degreed bart-degreed deleted the benchmarks-update branch February 12, 2020 10:16
@bart-degreed bart-degreed mentioned this pull request Feb 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants